from pyecharts.charts import Line
from pyecharts.options import TitleOpts, LabelOpts

from my_pyecharts import yiqing

"""
折线图演示疫情数据可视化
"""

us_x_data,us_y_data = yiqing.get_data("D:/Projects/pythonProject1/assets/美国.txt","jsonp_1629344292311_69436(")
yd_x_data,yd_y_data = yiqing.get_data("D:/Projects/pythonProject1/assets/印度.txt","jsonp_1629350745930_63180(")
jp_x_data,jp_y_data = yiqing.get_data("D:/Projects/pythonProject1/assets/日本.txt","jsonp_1629350871167_29498(")

line = Line()
# 设置全局选项
line.set_global_opts(
    title_opts=TitleOpts(title="2020美国日本印度确诊人数",pos_left="center",pos_bottom="1%")
)

# 共用x轴，添加一次即可
line.add_xaxis(us_x_data)
line.add_yaxis("美国确诊人数",us_y_data,label_opts=LabelOpts(is_show=False))
line.add_yaxis("印度确诊人数",yd_y_data,label_opts=LabelOpts(is_show=False))
line.add_yaxis("日本确诊人数",jp_y_data,label_opts=LabelOpts(is_show=False))

line.render()

